﻿<template>
    <div>
        <button @click="isShow=!isShow">显示/隐藏</button>
        <transition name="hello" :appear="true">
            <h2 v-show="isShow">你好啊</h2>
        </transition>
        
    </div>
</template>

<script>
    export default{
        name:'Test',
        components:{},
        data() {
            return {
                isShow:true
            }
        },
    }
</script>

<style scoped>
    h2{
        background-color: orange;
    }

    .hello-enter-active{
        animation: my 1s linear;
    }

    .hello-leave-active{
        animation: my 1s reverse;/*反转*/
    }
    @keyframes my {
        from{
            transform: translateX(-100%);
        }
        to{
            transform: translateX(0px);
        }
    }
</style>